package com.chat.common.user.dao;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chat.common.user.domain.entity.UserEmoji;
import com.chat.common.user.domain.vo.req.user.UserEmojiReq;
import com.chat.common.user.mapper.UserEmojiMapper;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserEmojiDao extends ServiceImpl<UserEmojiMapper, UserEmoji> {
    public List<UserEmoji> listByUid(Long uid) {
        return lambdaQuery().eq(UserEmoji::getUid, uid)
                .list();
    }

    public Integer countByUid(Long uid) {
        return lambdaQuery().eq(UserEmoji::getUid, uid)
                .count();
    }

    public Integer existsCount(UserEmojiReq req, Long uid) {
        return lambdaQuery().eq(UserEmoji::getUid, uid)
                .eq(UserEmoji::getExpressionUrl, req.getExpressionUrl())
                .count();
    }
}
